package com.yichen.ycOJ.judge.codesandbox.proxy;

import com.yichen.ycOJ.judge.codesandbox.CodeSandBox;
import com.yichen.ycOJ.judge.codesandbox.model.ExecutionCodeRequest;
import com.yichen.ycOJ.judge.codesandbox.model.ExecutionCodeResponse;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @Author: yichenwu
 * @Date:2024/6/24 9:19
 */
@Slf4j
public class CodeSandBoxProxy implements CodeSandBox {
    private final CodeSandBox codeSandBox;

    public CodeSandBoxProxy(CodeSandBox codeSandBox) {
        this.codeSandBox = codeSandBox;
    }

    @Override
    public List<ExecutionCodeResponse> executeCode(ExecutionCodeRequest executionCodeRequest) {
        log.info("代码沙箱请求信息：" + executionCodeRequest.toString());
        List<ExecutionCodeResponse> executeCodeResponse = codeSandBox.executeCode(executionCodeRequest);
        log.info("代码沙箱响应信息：" + executeCodeResponse.toString());
        return executeCodeResponse;
    }
}
